package com.arvin.controller;

import com.arvin.pojo.Result;
import com.arvin.service.ExcelImportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@Slf4j
@RequestMapping("/admin/import")
@Tag(name = "导入Excel文件",description = "导入excel文件进行统一操作")
public class ExcelImportController {

    @Autowired
    private ExcelImportService excelImportService;

    /**
     * 导入execl文件批量更新考试分数
     * @param file
     */
    @Operation(summary = "导入execl文件批量更新考试分数",description = "导入execl文件批量更新考试分数")
    @PostMapping("/excelImportExam")
    public Result<String> ExcelImportExam(MultipartFile file) throws IOException, InterruptedException {
        Result<String> result = excelImportService.excelImportExam(file);
        return result;
    }

    /**
     * 导入execl文件批量更新面试分数
     * @param file
     * @throws IOException
     * @throws InterruptedException
     */
    @Operation(summary = "导入execl文件批量更新面试分数",description = "导入execl文件批量更新面试分数")
    @PostMapping("/excelImportIntv")
    public Result<String> ExcelImportIntv(MultipartFile file) throws IOException, InterruptedException {
        Result<String> result = excelImportService.excelImportIntv(file);
        return result;
    }
}
